import cv2 as cv

fileName = r'D:\AI\AI_pythonCode\week1_SecondQ\lena.jpg'
img = cv.imread(fileName)
# 显示图片
cv.imshow('hello world',img)
cv.waitKey(20)
#  #分解成BGR分量并显示
cv.imshow('Blue', img[:, :, 0])
cv.imshow('Green', img[:, :, 1])
cv.imshow('Red', img[:, :, 2])
cv.waitKey(20)

# 将图片从BGR转换为HSV
HSI_img = cv.cvtColor(img, cv.COLOR_BGR2HSV)
# 分解成HSV分量并显示
cv.imshow('Hue', HSI_img[:, :, 0])
cv.imshow('Saturation', HSI_img[:, :, 1])
cv.imshow('Intensity', HSI_img[:, :, 2])

cv.waitKey()
cv.destroyWindow()